package resize

import (
	"github.com/astaxie/beego"
	"github.com/disintegration/imaging"
)

func ResizePro(inFile, outFile string) error {
	// Open a test image.
	src, err := imaging.Open(inFile)
	if err != nil {
		beego.Debug("failed to open image: %v", err)
		return err
	}
	// Resize the cropped image to width = 200px preserving the aspect ratio.
	src = imaging.Resize(src, 600, 0, imaging.Lanczos)
	// Save the resulting image as JPEG.
	err = imaging.Save(src, outFile)
	if err != nil {
		beego.Debug("failed to save image: %v", err)
		return err
	}
	return nil
}
